package service

import "gitee.com/gopher2011/mall/app/dao"

// 全局公开对象
var SmsHomeNewProduct = smsHomeNewProductService{}

// 私有对象，所有的方法都绑定到这个结构体上。

type smsHomeNewProductService struct{}

func (p *smsHomeNewProductService) Create(arg dao.SmsHomeNewProductReq) (int64, error) {
	return dao.SmsHomeNewProductDao.InsertTemplate(arg.List)
}

func (p *smsHomeNewProductService) UpdateSort(id int64, sort int32) (int64, error) {
	return dao.SmsHomeNewProductDao.UpdateTemplate(id, sort)
}

func (p *smsHomeNewProductService) Delete(ids []int64) (int64, error) {
	return dao.SmsHomeNewProductDao.Delete(ids)
}

func (p *smsHomeNewProductService) UpdateRecommendStatus(ids []int64, recommendStatus int32) (int64, error) {
	return dao.SmsHomeNewProductDao.UpdateRecommendStatus(ids, recommendStatus)
}

func (p *smsHomeNewProductService) List(arg dao.SmsHomeNewProductList) ([]dao.SmsHomeNewProduct, error) {
	arg.PageNum = (arg.PageNum - 1) * arg.PageSize
	return dao.SmsHomeNewProductDao.List(arg)
}
